package com.brainshare.quartz.task;

import com.brainshare.common.utils.DateUtils;
import com.brainshare.system.service.IRedPacketService;
import com.brainshare.system.service.ISysBuriedPointResultService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 筛查裂变版定时任务
 */
@Service("brainShareTask")
public class BrainShareTask {

    /**
     * 日志
     */
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    IRedPacketService redPacketService;

    @Autowired
    ISysBuriedPointResultService sysBuriedPointResultService;

    /**
     * 清理筛查领红包记录
     */
    public void clearAnRedPacketRecord() {
        logger.info("定时任务【clearAnRedPacketRecord】清理筛查领红包记录开始===========================");
        Integer clearResult = redPacketService.clearAnRedPacketRecord();
        logger.info("定时任务【clearAnRedPacketRecord】清理筛查领红包记录结果{}===========================", clearResult);
    }

    /**
     * 新增埋点结果
     */
    public void addBuriedPointResult() {
        String date = DateUtils.getStrPreDate();
        logger.info("定时任务【addBuriedPointResult】新增埋点结果开始，日期：{}===========================", date);
        sysBuriedPointResultService.addBuriedPointResult(date);
        logger.info("定时任务【addBuriedPointResult】新增埋点结果结束===========================");
    }

}
